﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CqusInfo.CR.Tool
{
    public class MyLogger
    {
        private static log4net.ILog log = log4net.LogManager.GetLogger("SinoSpace");

        /// <summary>
        /// 输出调试信息
        /// </summary>
        /// <param name="message">要输出调试信息</param>
        public static void Debug(object message)
        {
            log.Debug(message);
        }

        /// <summary>
        /// 输出调试信息
        /// </summary>
        /// <param name="type">调试信息的类，比如typeof(page),就是当前在page类进行调试</param>
        /// <param name="message">要输出调试信息</param>    
        public static void Debug(Type type, object message)
        {
            log = log4net.LogManager.GetLogger(type);
            log.Debug(message);
        }

        /// <summary>
        /// 输出错误信息
        /// </summary>
        /// <param name="type">发生错误的类，比如typeof(page),就是当前在page类发生了错误</param>
        /// <param name="message">要输出的错误信息</param>
        public static void Error(Type type, object message)
        {
            log = log4net.LogManager.GetLogger(type);
            log.Error(message);
        }
        /// <summary>
        /// 输出错误信息
        /// </summary>
        /// <param name="message">要输出的错误信息</param>
        public static void Error(object message)
        {
            log.Error(message);
        }

        /// <summary>
        /// 输出提示信息
        /// </summary>
        /// <param name="message">要输出提示信息</param>
        public static void Info(object message)
        {
            log.Info(message);
        }
        /// <summary>
        /// 输出提示信息
        /// </summary>
        /// <param name="type">要输出提示信息的类，比如typeof(page),就是当前在page类发出了提示信息</param>
        /// <param name="message">要输出提示的信息</param>
        public static void Info(Type type, object message)
        {
            log = log4net.LogManager.GetLogger(type);
            log.Info(message);
        }

        /// <summary>
        /// 输出警告信息
        /// </summary>
        /// <param name="message">输出警告信息</param>
        public static void Warn(object message)
        {
            log.Warn(message);
        }

        /// <summary>
        /// 输出警告信息
        /// </summary>
        /// <param name="type">要输出提示警告的类，比如typeof(page),就是当前在page类发出了警告信息</param>
        /// <param name="message">要输出的警告信息</param>
        public static void Warn(Type type, object message)
        {
            log = log4net.LogManager.GetLogger(type);
            log.Warn(message);
        }
    }
}
